﻿using AccessibilityTools.DB;
using AccessibilityTools.DB.Serivce;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TianYi.Bll
{
   public class PressureValueInfoLogic
    {
        PressureValueInfoDal PressureValueInfoDal = new PressureValueInfoDal();

        public List<PressureValueInfo> AllList()
        {
            return PressureValueInfoDal.Query();
        }

        public int Add(PressureValueInfo log)
        {
           int count= PressureValueInfoDal.Add(log);
            if (count>0)
            {
                return count;
            }
            return 0;
        }

        /// <summary>
        /// 通过二维码查询单个数据
        /// </summary>
        /// <param name="sn">二维码</param>
        /// <returns></returns>
        public PressureValueInfo GetInstance(string sn)
        {
            return PressureValueInfoDal.QuerySingle(sn);
        }
        /// <summary>
        /// 通过sn删除数据表
        /// </summary>
        /// <param name="sn">装箱码</param>
        public bool Delete(int sn)
        {
            bool p = PressureValueInfoDal.Delete(sn);
            return p;
        }
        public List<PressureValueInfo> SelectDetailsByDatetime(DateTime dtStart, DateTime dtEnd)
        {
            return PressureValueInfoDal.QueryYieldInfoByDate(dtStart, dtEnd);
        }
        public int Update(PressureValueInfo Instance)
        {
            int result = PressureValueInfoDal.Update(Instance);
            if (result>0)
            {
                return 1;
            }
            return 0;
        }

        public PressureValueInfo GetListByTime()
        {
            PressureValueInfo Instance = PressureValueInfoDal.GetListByTime();
            return Instance;
        }
    }
}
